Weather imapact on corn growth:
Quick Reference:
https://www.farmprogress.com/corn/10-keys-high-corn-yields
https://climatedataguide.ucar.edu/climate-data/overview-climate-indices
Questions looking for in this analysis:
Raw weather data gathered:
Weather features:
## Rows: 96
## Columns: 8
## $ year <dbl> 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, …
## $ sp_rain <dbl> 6.90, 5.58, 6.70, 8.63, 7.65, 9.25, 6.98, 6.67, 6.87, 8.40, …
## $ sp_tavg <dbl> 48.45000, 52.99000, 50.23667, 51.20000, 50.90000, 51.19667, …
## $ sm_rain <dbl> 7.35, 7.62, 8.57, 8.68, 10.50, 7.00, 6.08, 7.57, 8.51, 7.14,…
## $ sm_tavg <dbl> 84.37333, 85.03000, 84.57333, 82.49000, 82.98000, 84.71000, …
## $ avg_pdsi <dbl> -0.3808333, -2.0600000, 0.4183333, 2.8366667, 2.7808333, 1.0…
## $ sp_z <dbl> -0.2033333, -2.9566667, -0.9500000, 0.6566667, -0.1933333, 1…
## $ sm_z <dbl> -0.75000000, -1.40333333, -0.04000000, 1.47000000, 3.3433333…
## Warning: Removed 1 row(s) containing missing values (geom_path).
## Warning: Removed 1 row(s) containing missing values (geom_path).
rank of biggest yield increase: 1994 2013 1989 1984 1992
## Registered S3 method overwritten by 'xts':
## method from
## as.zoo.xts zoo
Current year YIELD vs WEATHER
ACREAGE-LEAD-1 vs WEATHER
Current year YIELD DIFFERENCE vs WEATHER
PerformanceAnalytics::chart.Correlation(main[, c("acre_planted_corn_lead1", "sp_z", "sm_z", "sp_tavg", "sm_tavg", "sp_rain", "sm_rain")], histogram=F)
Acreage, yield lead(1) vs spring Z-index, summer Z-index
## [1] 979496.5
## 7 x 1 sparse Matrix of class "dgCMatrix"
## 1
## (Intercept) -164624816.5
## sp_z .
## sm_z .
## sp_tavg .
## sm_tavg 2863017.7
## sp_rain 608477.6
## sm_rain .
## [,1]
## 1 0.1567652
## [1] 0.0420768
## 7 x 1 sparse Matrix of class "dgCMatrix"
## 1
## (Intercept) -791.5831355
## sp_z 13.9080018
## sm_z -23.9356521
## sp_tavg 17.4693838
## sm_tavg -5.1713727
## sp_rain 0.5537153
## sm_rain 49.8218887
## [,1]
## 1 0.3397009
leads <- create_lead(main, "acre_planted_corn", 9)
main <- leads$data
col <- c("sm_tavg", "acre_planted_corn", leads$lead_col)
PerformanceAnalytics::chart.Correlation(main[, ..col], histogram=F)
lags <- create_lag(main, "sm_tavg", 9)
main <- lags$data
col <- c("acre_planted_corn", lags$lag_col)
PerformanceAnalytics::chart.Correlation(main[, ..col], histogram=F)
colnames(main) <- make.unique(names(main))
ggplot(main[year>1959,]) +
geom_vline(xintercept = seq(1960, 2020, 5), color = "gray20") +
geom_vline(xintercept = seq(1960, 2020, 1), color = "gray95") +
geom_line(aes(x= year, y = sm_tavg/20-3, color = "summer temp")) +
# geom_line(aes(x= year, y = acre_planted_corn/1E8, color = "acre current cropyear")) +
geom_line(aes(x= year, y = acre_planted_corn_lead1/1E8, color = "acre lead crop year")) +
theme_classic()
## Warning: Removed 1 row(s) containing missing values (geom_path).
## [1] 133604.5
## 7 x 1 sparse Matrix of class "dgCMatrix"
## 1
## (Intercept) -388904771.4
## sp_z 276776.8
## sm_z 1665011.9
## sp_tavg .
## sm_tavg 5474490.8
## sp_rain 975039.0
## sm_rain .
## [,1]
## 1 0.1879185
## [1] 0.1493175
## 7 x 1 sparse Matrix of class "dgCMatrix"
## 1
## (Intercept) -844.680179
## sp_z .
## sm_z -22.022703
## sp_tavg 12.969034
## sm_tavg -3.029413
## sp_rain 14.104419
## sm_rain 49.093153
## [,1]
## 1 0.3561923
>>>>>>> Stashed changes